﻿using Orchard.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NHibernate.Linq;
using Autofac;
using System.Linq.Expressions;

namespace NineSeas.Services
{
    public class CustomRepository<T>: Repository<T>, ICustomRepository<T> where T: class
    {
        public CustomRepository(ISessionLocator sessionLocator)
            : base(sessionLocator)
        {
            
        }

        public override System.Linq.IQueryable<T> Table
        {
            get { return Session.Query<T>(); }
        }
    }

    public class MyDataModule : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterGeneric(typeof(CustomRepository<>)).As(typeof(ICustomRepository<>)).InstancePerDependency();
        }
    }
}